-
Notifications
You must be signed in to change notification settings - Fork 500
⚡️ uint8array set method instead of spread #1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
38b42c8
to
028f861
Compare
@@ -327,8 +327,11 @@ export class XetBlob extends Blob { | |||
totalFetchBytes += result.value.byteLength; | |||
|
|||
if (leftoverBytes) { | |||
result.value = new Uint8Array([...leftoverBytes, ...result.value]); | |||
leftoverBytes = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the leftoverBytes = undefined
part is important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also make the function into a combineUint8Arrays
helper? ( a dedicated file in this folder)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, I'll take care of it.
7a7e64f
to
699b51a
Compare
some formatting issues, you can run |
4540655
to
688dd77
Compare
Oh sorry for that, I didn't run the right command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hello @coyotte508
I stumbled upon this issue.
I suggest to use the set method instead.
Benchmark: https://jsben.ch/jze3P